package com.itsm.user.controller;


import com.itsm.common.core.domain.R;
import com.itsm.user.entity.JzsyRbacUser;
import com.itsm.user.service.IUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static com.itsm.common.core.domain.R.ok;

@Api(tags = "用户")
@RestController
@RequestMapping("/itsm/user")
public class UserController {


    @Autowired
    private IUserService userService;

    @PostMapping("/register")
    public R<?> register(String userName){
        JzsyRbacUser jzsyRbacUser = userService.register(userName);
        return R.ok(jzsyRbacUser,"注册成功!");
    }

    @PostMapping("/getUserByName")
    public R<?> getUserByName(@RequestParam String userName){
        return R.ok(userService.getUserByName(userName),"成功") ;

    }





}
